<?php
    if(!$this->session->userdata('logged_in')) {
        redirect('logout');
    }
?>
<div id="post_container">
    <div id="post_wrapper">
        <table id="post_table">
            <th id="post_title_header">Title</th>
            <?php 
                if($this->session->userdata('role') !== 'author'){
                    echo '<th id="post_author">Author</th>';
                }
            ?>
            <th id="post_pub_date">Date Published</th>
            <th id="post_mod_date">Date Modified</th>
            <th> Post Location</th>
<!--            <th id="post_edit"></th>
            <th id="post_delete"></th>-->
            <?php foreach ($post as $post_item): ?>
            <tr>
                <td class="td_left"><?php echo '<a href="post/edit/'.$post_item['post_id'].'">'.$post_item['title'].'</a>'; ?></td>
                <?php
                    if($this->session->userdata('role') !== 'author'){
                        echo "<td class='td_left'>" . $post_item['lname'].",". $post_item['fname'] . "</td>";
                    }
                ?>
                <td class="td_left"><?php echo $post_item['date_time_pub']; ?></td>
                <td class="td_left"><?php echo $post_item['date_time_modified']; ?></td>
                <td><?php echo $post_item['hey'];?></td>
                <td class="td_center"><?php echo anchor('post/delete/'.$post_item['post_id'], 'Delete', array('onClick' => "return confirm('Are you sure you want to delete?')"));?></td>
            </tr>
            <?php endforeach; ?>
        </table>
    </div>
    <div class="balancer"></div>
</div>
